/****************************************************************************
 *   Copyright (C) 2008 by 7552                                             *
 *   fiubataller2-08c1@gruposyahoo.com.ar                                   *
 *                                                                          *
 *  Licensed under the Apache License, Version 2.0 (the "License");         *
 *  you may not use this file except in compliance with the License.        *
 *  You may obtain a copy of the License at                                 *
 *                                                                          *
 *      http://www.apache.org/licenses/LICENSE-2.0                          *
 *                                                                          *
 *  Unless required by applicable law or agreed to in writing, software     *
 *  distributed under the License is distributed on an "AS IS" BASIS,       *
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.*
 *  See the License for the specific language governing permissions and     *
 *  limitations under the License.                                          *
 *                                                                          *
 ***************************************************************************/

#ifndef __CRITICAL_SECTION__
#define __CRITICAL_SECTION__

#include <pthread.h>


namespace Taller2
{
namespace TransRec
{

class CCriticalSection
{
protected:
	pthread_mutex_t m_mutex;
	bool	m_bLocked;

public:	
	CCriticalSection(pthread_mutex_t &cs, bool locked = true);
	~CCriticalSection();

	static void CreateCriticalSection(pthread_mutex_t &cs);
	static void DeleteCriticalSection(pthread_mutex_t &cs);

	void Lock();
	void Unlock();
};
};
};
#endif
